package com.tm.dk.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tm.dk.dto.MonitorDTO;
import com.tm.dk.mapper.MonitorMapper;
import com.tm.dk.service.MonitorService;
import com.tm.entity.MonitorEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, MonitorEntity> implements MonitorService {

    @Autowired
    private MonitorMapper monitorMapper;
    public Page<MonitorEntity> pageList(Integer page, Integer pageSize, MonitorEntity monitorEntity) {
        QueryWrapper<MonitorEntity> queryWrapper =new QueryWrapper<MonitorEntity>();
     //   queryWrapper.like("hostcode",monitorEntity.getHostcode());
        Page<MonitorEntity> page3 =new Page<MonitorEntity>(page,pageSize);
        Page<MonitorEntity> page2 = monitorMapper.page1(page3,queryWrapper);
        Long count = monitorMapper.selectCount(queryWrapper);
        page2.setTotal(count);

        return page2;
    }
  /*  public Page<MonitorDTO> pageList(MonitorDTO monitorDTO) {
        QueryWrapper<MonitorDTO> queryWrapper =new QueryWrapper<MonitorDTO>();

        queryWrapper.like(StringUtils.isBlank(monitorDTO.getHostcode()),"hostcode",monitorDTO.getHostcode());

        Page<MonitorDTO> page3 =new Page<MonitorDTO>(monitorDTO.getPage(),monitorDTO.getPageSize());

        Page<MonitorDTO> monitorDTOPage = monitorMapper.selectPage(page3, queryWrapper);

        return monitorDTOPage;
    }*/

}
